package com.entity;

import com.group.ITypeStrategy;

/**
 * 策略执行器,按sort排序执行
 */
public class StrategyExecutor implements Comparable{
    public ITypeStrategy strategy;
    public int sort;

    public StrategyExecutor(ITypeStrategy strategy, int sort) {
        this.strategy = strategy;
        this.sort = sort;
    }

    public ITypeStrategy getStrategy() {
        return strategy;
    }

    public void setStrategy(ITypeStrategy strategy) {
        this.strategy = strategy;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    @Override
    public int compareTo(Object o) {
        StrategyExecutor o1 = (StrategyExecutor)o;
        return this.getSort() - o1.getSort();
    }
}
